Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: metadata output interaction with natspec #3627

Merged
merged 2 commits into from
Sep 28, 2023

Conversation

charles-cooper
Copy link
Member

@charles-cooper charles-cooper commented Sep 28, 2023

enabling the -f metadata output has an interaction with other outputs because the metadata output format mutates some internal data structures in-place. this is because vars() returns a reference to the object's __dict__ as opposed to a copy of it. the behavior can be seen by trying to call the compiler with -f metadata,devdoc,userdoc.

this commit fixes the issue by constructing a copy of the object during metadata output formatting. it also modifies the test suite to include more output formats, to test the interactions between these different output formats. in doing so, it was also found that some examples have invalid natspec, which has also been fixed.

the issue was revealed in (but not introduced by) #3622, because that causes the relevant interaction to happen when constructing vyper-json '*' output.

What I did

How I did it

How to verify it

Commit message

enabling the `-f metadata` output has an interaction with other outputs
because the metadata output format mutates some internal data structures
in-place. this is because `vars()` returns a reference to the object's
`__dict__` as opposed to a copy of it. the behavior can be seen by
trying to call the compiler with `-f metadata,devdoc,userdoc`. this
issue was revealed in (but not introduced by) 2bdbd846b0, because that
commit caused metadata and userdoc to be bundled together by default.

this commit fixes the issue by constructing a copy of the object during
metadata output formatting. it also modifies the test suite to include
more output formats, to test the interactions between these different
output formats. in doing so, it was also found that some examples have
invalid natspec, which has also been fixed.

Description for the changelog

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

enabling the `-f metadata` output has an interaction with other outputs
because the metadata output format mutates some internal data structures
in-place. this is because `vars()` returns a reference to the object's
`__dict__` as opposed to a copy of it. the behavior can be seen by
trying to call the compiler with `-f metadata,devdoc,userdoc`.

this commit fixes the issue by constructing a copy of the object during
metadata output formatting. it also modifies the test suite to include
more output formats, to test the interactions between these different
output formats. in doing so, it was also found that some examples have
invalid natspec, which has also been fixed.
@codecov-commenter
Copy link

codecov-commenter commented Sep 28, 2023

Codecov Report

Merging #3627 (8a74b78) into master (2bdbd84) will increase coverage by 0.03%.
The diff coverage is 66.66%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@            Coverage Diff             @@
##           master    #3627      +/-   ##
==========================================
+ Coverage   89.01%   89.04%   +0.03%     
==========================================
  Files          86       86              
  Lines       11460    11460              
  Branches     2606     2606              
==========================================
+ Hits        10201    10205       +4     
+ Misses        836      832       -4     
  Partials      423      423              
Files Coverage Δ
vyper/compiler/output.py 91.66% <66.66%> (ø)

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@charles-cooper charles-cooper merged commit aecd911 into vyperlang:master Sep 28, 2023
82 checks passed
@charles-cooper charles-cooper deleted the fix/metadata-natspec branch September 28, 2023 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants